package com.fastjars.business.upload;

import java.util.HashMap;
import java.util.Map;

/**
 * Action
 *
 * @author Brant Liu <br> 邮箱：<br>lbf1988@qq.com <br>日期：<br>2018/04/16
 * @version 1.0.0
 */
public final class Action {
    public static final Map<String, Integer> mapping;

    public static final String ACTION_DEFAULT_UPLOAD_FILE = "uploadfile";

    public static final int CONFIG = 0;
    public static final int UPLOAD_IMAGE = 1;
    public static final int UPLOAD_SCRAWL = 2;
    public static final int UPLOAD_VIDEO = 3;
    public static final int UPLOAD_FILE = 4;
    public static final int CATCH_IMAGE = 5;
    public static final int LIST_FILE = 6;
    public static final int LIST_IMAGE = 7;
    public static final int READ_WORD = 8;
    public static final int UPLOAD_ADDON = 9;

    static {
        mapping = new HashMap<String, Integer>() {{
            put("config", Action.CONFIG);
            put("uploadimage", Action.UPLOAD_IMAGE);
            put("uploadscrawl", Action.UPLOAD_SCRAWL);
            put("uploadvideo", Action.UPLOAD_VIDEO);
            put(ACTION_DEFAULT_UPLOAD_FILE, Action.UPLOAD_FILE);
            put("addon", Action.UPLOAD_ADDON);
            put("catchimage", Action.CATCH_IMAGE);
            put("listfile", Action.LIST_FILE);
            put("listimage", Action.LIST_IMAGE);
            put("word", Action.READ_WORD);
        }};
    }

    public static int getType(String key) {
        return Action.mapping.get(key);
    }
}
